import socket
import urllib.request  
import json
proxy_handler = urllib.request.ProxyHandler({'http':'proxy01.cnooc:8080'})  
proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()
host = "114.215.194.241"
port = 9504
# port = 80
codeStr = ["CONC","OILZ", "DINIW", "XAU", "XAG"];    
msg = {'type': 'client',
        'code': codeStr,
        'crypt': '\u00002Z2\b7\u0002fR;\u000en\u0005dQ5Z1\u000b2\u0007oWq\u0001f\u0002gR(\u00011'};
msgJson = json.dumps(msg)
print(msgJson, flush = True)
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)     
s.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
s.connect((host,port))

print("success", flush = True)